<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@ include file="../../../attr.jsp" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=emulateIE7"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta charset="utf-8">
    <link rel="stylesheet" href="${ctx}/css/sapar.css"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/common.css"/>
    <script type="text/javascript" src="${ctx}/js/jquery.js"></script>
    <script type="text/javascript" src="${ctx}/js/sapar.js"></script>
    <script type="text/javascript" src="${ctx}/js/WdatePicker.js"></script>
    <script type="text/javascript" src="${ctx}/assets/layer/layer.js"></script>
    <script type="text/javascript" src="${ctx}/js/mask.js"></script>
    <title>编辑网篮</title>
</head>

<body>
<div id="mask" class="mask"></div>
<div id="saper-container">
    <div id="saper-hd"></div>
    <div id="saper-bd">
        <div class="subfiled clearfix">
            <h2>编辑网篮</h2>
        </div>
        <div class="subfiled-content">
            <form class="saper-form" id="dataForm">
                <%--<div class="kv-item clearfix">--%>
                <%--<label><span class="impInfo">*</span>网篮条码：</label>--%>
                <%--<div class="kv-item-content">--%>
                <%--<input type="text" placeholder="网篮条码" onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')" class="txt_required" name="wlTiaoma" value="${zsWanglan.wlTiaoma}" <c:if test="${zsWanglan.isReadOnly==1}">readonly="readonly"</c:if>>--%>
                <%--</div>--%>
                <%--<div class="kv-item-tip">修改时条码不允许修改</div>--%>
                <%--</div>--%>
                <div class="kv-item clearfix">
                    <label><span class="impInfo">*</span>网篮名称：</label>
                    <div class="kv-item-content">
                        <input type="hidden" name="wlTiaoma" value="${zsWanglan.wlTiaoma}"/>
                        <input type="text" placeholder="网篮名称" class="txt_required" name="wlMingcheng"
                               value="${zsWanglan.wlMingcheng}"
                               onkeyup="this.value=this.value.replace(/(^\s*)|(\s*$)/g,'')">
                    </div>
                </div>

                <div class="kv-item clearfix">
                    <label><span class="impInfo">*</span>网篮属性：</label>
                    <div class="kv-item-content">
                        <select class="empty" id="wlType" name="wlType">
                            <c:if test="${wlprop!=null}">
                                <c:forEach items="${wlprop}" var="prop">
                                    <option value="${prop.dictId}"
                                            <c:if test="${zsWanglan.wlType==prop.dictId}">selected='selected'</c:if> >${prop.dictName}</option>
                                </c:forEach>
                            </c:if>

                        </select>
                    </div>
                </div>

                <div class="kv-item clearfix">
                    <label><span class="impInfo">*</span>网篮分类：</label>
                    <div class="kv-item-content">
                        <select class="empty" id="wlCategory" name="wlCategory">
                            <option value="1"
                                    <c:if test="${zsWanglan.wlCategory==1}">selected='selected'</c:if> >回收清洗网篮
                            </option>
                        </select>
                    </div>
                </div>

                <div class="kv-item clearfix">
                    <label>包：</label>
                    <div class="kv-item-content">

                    </div>
                </div>

                <div class="buttons">
                    <a href="javascript:;" class="sapar-btn sapar-btn-recom">确定</a>
                    <input type="hidden" name="isReadOnly" id="isReadOnly" value="${zsWanglan.isReadOnly}"/>
                </div>
            </form>
        </div>
    </div>
    <div id="saper-ft"></div>
</div>

</body>

<script type="text/javascript">
    function isNullOrEmpty(strVal) {
        strVal = strVal.replace(/(^\s*)|(\s*$)/g, "");
        if (strVal == '' || strVal == null || strVal == undefined) {
            return true;
        } else {
            return false;
        }
    }


    $(function () {
        $(".sapar-btn-recom").click(function () {
            var btn = true;
            $(".txt_required").each(function () {
                var str = $(this).val();
                if (isNullOrEmpty(str)) {
                    btn = false;
                    layer.msg("必填项不为空");
                    return false;
                }
            });
            if (btn) {
                showMask();
                $.ajax({
                    type: "POST",
                    url: "${ctx}/wanglan/wanglanSave.do",
                    data: $('#dataForm').serialize(),// 你的formid
                    error: function (request) {
                        layer.alert("网络故障，请稍后再试!");
                    },
                    success: function (data) {
                        $("#mask").hide();
                        if (data.status == "true") {
                            layer.alert("保存成功", function () {
                                window.location.href = "${ctx}/wanglan/wanglanList.do";
                            });
                        } else {
                            layer.msg(data.msg);
                        }
                    }
                });
            }
        });
    });


</script>
</html>